<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name;
?>

<div class="box box_login">
    <div class="header_full">Đăng Nhập</div>

    <form
        id       = "frm_login"
        name     = "frm_login"
        method   = "post"
        class    = "form_input"
        onsubmit = "return form_onsubmit();"
    >
        <fieldset>
            <div class="form_input_row">
                <label class="label_title">Tên Tài Khoản:*</label>

                <div class="input_item">
                    <input
                        id         = "txt_account"
                        name       = "txt_account"
                        title      = "Tên Tài khoản Của Bạn"
                        type       = "text"
                        value      = ""
                        onkeypress = "return keypress_alphanumberic(event);"
                        tabindex   = "1"
                    />

                    <label
                        id    = "lbl_account_validation" 
                        class = "lable_validation"
                    >Bạn phải nhập vào tên tài khoản hơn 4 ký tự.</label>
                </div>
            </div>

            <div class="form_input_row">
                <label class="label_title">Mật Khẩu:*</label>

                <div class="input_item">
                    <input
                        id       = "txt_password"
                        name     = "txt_password"
                        title    = "Mật Khẩu Của Bạn"
                        type     = "password"
                        value    = ""
                        tabindex = "2"
                    />

                    <label
                        id    = "lbl_password_validation" 
                        class = "lable_validation"
                    >Bạn phải nhập vào mật khẩu hơn 4 ký tự.</label>
                </div>
            </div>

            <div class="form_input_row border_bottom_none">
                <div class="input_items">
                    <input
                        title    = "Ghi nhớ lần đăng nhập kế tiếp"
                        name     = "chk_remember"
                        id       = "chk_remember"
                        type     = "checkbox"
                        tabindex = "8"
                    />
                    <label for = "chk_remember">Ghi nhớ lần đăng nhập kế tiếp</label>
                </div>
            </div>

            <div class="row_bottom">
                <input
                    title    = "gửi yêu cầu"
                    name     = "btn_login"
                    id       = "btn_login"
                    type     = "submit"
                    value    = "Đăng Nhập"
                    tabindex = "4"
                />
            </div>
        </fieldset>
    </form>
</div><!-- End box -->

<script type="text/javascript">
$(document).ready(function()
{
    $('#txt_account').focus();

    function form_onsubmit(param)
    {
        if (document.forms[param].txt_account.value=="" || document.forms[param].txt_account.value.length < 4) {
            $("#lbl_account_validation").fadeIn("slow", "linear");
            $("#txt_account").focus();
            return false;
        }

        if (document.forms[param].txt_password.value=="" || document.forms[param].txt_password.value.length < 4) {
            $("#lbl_password_validation").fadeIn("slow", "linear");
            $("#txt_password").focus();
            return false;
        }

        if(document.forms[param].txt_catcha != null && document.forms[param].txt_catcha.value == "") {
            $("#lbl_catcha_validation").fadeIn("slow", "linear");
            $("#txt_catcha").focus();
            return false;
        }

        return true;
    }//End form_onsubmit

    $('#txt_account').change(function()
    {
        var name_without_space = $("#txt_account").val().replace(/ /g,'');
        var name_without_special_char = name_without_space.replace(/[<>']+/g,'');
        $(this).attr("value", name_without_special_char );
    });//End $('#txt_account').change
});
</script>